#include "apue.h"
#include <stdio.h>
#include <sys/utsname.h>

int main(void) {
    struct utsname uts;
    if (uname(&uts) < 0) 
        err_sys("uname error");
    

    printf("sysname = %s\n", uts.sysname);  // uname -s, --kernel-name [or -o, --operating-system]
    printf("nodename = %s\n", uts.nodename);    // uname -n, --nodename
    printf("release = %s\n", uts.release);  // uname -r, --kernel-release 
    printf("version = %s\n", uts.version);  // uname -v, --kernel-version
    printf("machine = %s\n", uts.machine);  // uname -m, --machine
    return(0);
}
